package net.huashitong.Indicators.dao;

import net.huashitong.Indicators.entity.TertiaryIndustry;
import net.huashitong.Indicators.filter.IndicatorBreakdownFilter;

import org.springframework.stereotype.Repository;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
@Repository
public class TertiaryIndustryDao extends StringDao<TertiaryIndustry> {

	public TertiaryIndustry queryByfilter(IndicatorBreakdownFilter filter) {
		GenericQuery query  = createQuery("obj");
		query.append(" and obj.sysId = :industryId").setParam("industryId", filter.getIndustryId());
		query.append(" and obj.year = :year").setParam("year", filter.getCurrentMonth().substring(0,4));
		return query.singleResult();
	}
    
	public TertiaryIndustry queryBySysId(String sysid){
		GenericQuery query  = createQuery("obj");
		query.append(" and obj.sysId = :sysid").setParam("sysid",sysid);
		return query.firstResult();
	}
	
}
